/*******************************************************************************
*  FILE PURPOSE: Define data types for C
********************************************************************************
*
* FILE NAME: typedefs.h
*
* DESCRIPTION:
*       This file contains common data type definitions
*
*  Copyright (c) 2009 Texas Instruments Inc.
*  All Rights Reserved This program is the confidential and proprietary
*  product of Texas Instruments Inc.  Any Unauthorized use, reproduction or
*  transfer of this program is strictly prohibited.
*
* HISTORY:
*
* 10/26/2004 S.Yim             Written
* 09/13/2006 U.Dasgupta        Added defines to help division by 3.
* 11/10/2006 S.Yim             Change the definitions of WIMAX_status_t to align
*                              withe M2P I/F
* 09/11/2007 S.Yim             Added MAC types.h here 
* 11/11/2008 R.Liang	       port to DSP/BIOS
*
* LIST OF FUNCTION PROTOTYPES:
*
******************************************************************************/
#ifndef _TYPEDEFS_H
#define _TYPEDEFS_H


//----------------------------------------------------------------------------
//                      Global Macro Declarations
//----------------------------------------------------------------------------
#ifndef TRUE
#define TRUE                    (1)
#define FALSE                   (0)
#endif

typedef enum 
{
  EVEN = 0,
  ODD = 1
} parity_t;

#define PARITY(a) ((a) % 2)

#define ALIGN16(len)    (((len) + 1) & ~1)

#define __byte(a,b)  ((UINT8)(a[b]))

//----------------------------------------------------------------------------
//                      Global Typedef Declarations
//----------------------------------------------------------------------------

/* size of, in octets */
#define OCTETS(x)   ((sizeof(x)) * (CHAR_BIT >> 3))

typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned long      uint32;

typedef short              int16;
typedef long               int32;

typedef unsigned short     Uint16;
typedef unsigned long      Uint32;

typedef float              float32;

typedef long               RCODE;
typedef unsigned long      bool;

// Read-Write Data Types
typedef unsigned char         UINT8;      // UnSigned 8-bit integer (15-bit magnitude)
typedef signed char           SINT8;      // Signed 8-bit integer (15-bit magnitude)
typedef signed short          SINT16;     // Signed 16-bit integer (15-bit magnitude)
typedef unsigned short        UINT16;     // Unsigned 16-bit integer
typedef signed long           SINT32;     // Signed 32-bit integer (31-bit magnitude)
typedef unsigned long         UINT32;     // Unsigned 32-bit integer
typedef  __int64              SINT64;     // Signed 64-bit integer
typedef unsigned  __int64     UINT64;     // Unsigned 64-bit integer
typedef short                 BOOL;       // Only TRUE/FALSE applied

// All pointers are 32 bits long
typedef SINT16                *PSINT16;   // Pointer to SINT16
typedef UINT16                *PUINT16;   // Pointer to UINT16
typedef SINT32                *PSINT32;   // Pointer to SINT32
typedef UINT32                *PUINT32;   // Pointer to UINT32


#define SIZEOF_SINT16         2
#define SIZEOF_UINT16         2
#define SIZEOF_SINT32         4
#define SIZEOF_UINT32         4

//----------------------------------------------------------------------------
//                      Complex data Typedef Declarations
//----------------------------------------------------------------------------
typedef struct
{
	SINT16 real;
	SINT16 imag;
} ComplexShort;

//----------------------------------------------------------------------------
//                      Circular buffer Typedef Declarations
//----------------------------------------------------------------------------
typedef struct
{
	SINT16 *buf_p;   // buffer base addr
	UINT16 rdIdx;    // read index
	UINT16 wtIdx;    // write index
	UINT16 bufSize;  // buf size in 16-bits words
}Buffer_t;

#endif //_TYPEDEFS_H




